package com.shui_shui;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.ImageView;

public class SubMenuActivity extends Activity implements OnTouchListener{

	private ImageView rb1;	
	private ImageView rb2;	
	private ImageView rb3;	
	private ImageView rb4; 
	
	private ImageView back;	
	private ImageView help; 
	
	private Intent newActivity;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
    	super.onCreate(savedInstanceState);        
		setContentView(R.layout.submenu);           
		
		 // Menu Image        
		rb1 = (ImageView) findViewById(R.id.rb1);        
		rb2 = (ImageView) findViewById(R.id.rb2);        
		rb3 = (ImageView) findViewById(R.id.rb3);        
		rb4 = (ImageView) findViewById(R.id.rb4); 
		
		 // Menu Image             
		back = (ImageView) findViewById(R.id.back);        
		help = (ImageView) findViewById(R.id.help);         
		
		//  Set Even OnTouch        
		rb1.setOnTouchListener(this);        
		rb2.setOnTouchListener(this);        
		rb3.setOnTouchListener(this);        
		rb4.setOnTouchListener(this);
		
		//  Set Even OnTouch  MenuBar       
		back.setOnTouchListener(this);        
		help.setOnTouchListener(this);
		
    }

	@SuppressWarnings("deprecation")
	public boolean onTouch(View v, MotionEvent event) {
		switch (v.getId()) {        
		case R.id.rb1:            
			switch (event.getAction()) {            
			case MotionEvent.ACTION_DOWN:            
				rb1.setAlpha(150);                
				break;            
			case MotionEvent.ACTION_UP:            
				rb1.setAlpha(255);
				newActivity = new Intent(SubMenuActivity.this,FengshuiActivity.class);
				startActivity(newActivity);	
				break;            
			default:                
				break;            
			}            
			break; 
		case R.id.rb2:            
			switch (event.getAction()) {            
			case MotionEvent.ACTION_DOWN:            
				rb2.setAlpha(150);                
				break;
			case MotionEvent.ACTION_UP:            
				rb2.setAlpha(255);
				newActivity = new Intent(SubMenuActivity.this,LocationBaseActivity.class);
				startActivity(newActivity);	
				break;            
			default:                
				break;            
			}            
			break; 
		case R.id.rb3:            
			switch (event.getAction()) {            
			case MotionEvent.ACTION_DOWN:            
				rb3.setAlpha(150);                
				break;            
			case MotionEvent.ACTION_UP:            
				rb3.setAlpha(255);
				newActivity = new Intent(SubMenuActivity.this,GuideActivity.class);
				startActivity(newActivity);	
				break;            
			default:                
				break;            
			}            
			break; 
		case R.id.rb4:            
			switch (event.getAction()) {            
			case MotionEvent.ACTION_DOWN:            
				rb4.setAlpha(150);                
				break;            
			case MotionEvent.ACTION_UP:            
				rb4.setAlpha(255);
				newActivity = new Intent(SubMenuActivity.this,RevisionActivity.class);
				startActivity(newActivity);	
				break;            
			default:                
				break;            
			}            
			break;         
		case R.id.back:            
			switch (event.getAction()) {            
			case MotionEvent.ACTION_DOWN:            
				back.setAlpha(150);                
				break;            
			case MotionEvent.ACTION_UP:            
				back.setAlpha(255);	
				this.finish();
				break;            
			default:                
				break;            
			}            
			break;        
		case R.id.help:            
			switch (event.getAction()) {            
			case MotionEvent.ACTION_DOWN:            
				help.setAlpha(150);                
				break;            
			case MotionEvent.ACTION_UP:            
				help.setAlpha(255);                
				break;            
			default:                
				break;            
			}            
			break; 
		}        
		return true;
	}

}
